package test;

public class fq {
    public static void main(String[] args) {
        int zong=1000000;
        int count = 0;
        while (zong>0){
            count+=zong%7;
            zong=zong/7;


        }
        System.out.println(count);
    }
}
